Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow custom websocket server #2338

Merged
merged 1 commit into from
Mar 15, 2021
Merged

Conversation

egoist
Copy link
Contributor

@egoist egoist commented Mar 2, 2021

In middleware mode Vite starts a separate websoket server but some cloud IDEs (like repl.it) only expose port 80/443 so a separate server is not an option, this PR adds config.server.hmr.server to allow a custom user-provided websocket server.

@amasad
Copy link

amasad commented Mar 2, 2021

You can. See vite.config.js here https://repl.it/@templates/Reactjs

@egoist
Copy link
Contributor Author

egoist commented Mar 2, 2021

@amasad it works in default mode, but in middleware mode Vite starts a new server for websocket.

@shigma
Copy link
Contributor

shigma commented Mar 4, 2021

Unrelated but this pr may also solves #2372? 🤣

@antfu antfu added the enhancement New feature or request label Mar 15, 2021
@@ -20,6 +21,7 @@ export interface HmrOptions {
path?: string
timeout?: number
overlay?: boolean
server?: Server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be http.Server instead (which is then passed to createWebScoketServer as the first argument)? It feels weird to require the user to create a ws server.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nvm..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants